import request from '@/utils/request'

// 贷款申请管理接口
export const loanApplyApi = {
  // 获取贷款申请列表
  getList(params) {
    return request({
      url: '/loan/apply/list',
      method: 'get',
      params
    })
  },
  
  // 获取贷款申请详情
  getInfo(applyId) {
    return request({
      url: `/loan/apply/${applyId}`,
      method: 'get'
    })
  },
  
  // 提交贷款申请
  add(data) {
    return request({
      url: '/loan/apply',
      method: 'post',
      data
    })
  },
  
  // 修改贷款申请
  update(data) {
    return request({
      url: '/loan/apply',
      method: 'put',
      data
    })
  },
  
  // 删除贷款申请
  delete(applyId) {
    return request({
      url: `/loan/apply/${applyId}`,
      method: 'delete'
    })
  },
  
  // 上传申请附件
  uploadFile(data) {
    return request({
      url: '/loan/apply/upload',
      method: 'post',
      headers: {
        'Content-Type': 'multipart/form-data'
      },
      data
    })
  }
}

// 贷款审批管理接口
export const loanApprovalApi = {
  // 获取待审批列表
  getPendingList(params) {
    return request({
      url: '/loan/approval/pending',
      method: 'get',
      params
    })
  },
  
  // 提交审批
  submit(data) {
    return request({
      url: '/loan/approval',
      method: 'post',
      data
    })
  },
  
  // 获取审批历史
  getHistory(applyId) {
    return request({
      url: `/loan/approval/history/${applyId}`,
      method: 'get'
    })
  }
} 